<template>
	<view class="w-container">
    <t-header @back="clickNavBackFn">在线客服</t-header>
		<view class="w-content" style="position: relative;">
			<web-view :src="url" style="position: absolute; top: -20rpx;"></web-view>
		</view>
	</view>
</template>

<script setup>
import {ref} from 'vue';
import {onLoad} from '@dcloudio/uni-app';

import THeader from '@/components/views/t-header/index.vue'; // 头部组件

const url = ref('');

onLoad((t) => {
	if(t.url){
		url.value = t.url
	}else{
		url.value = uni.getStorageSync('sysConfig').kf_url;
		uni.setNavigationBarTitle({
			title:'在线客服'
		})
	}
})

// 点击返回
const clickNavBackFn = () => {
	const pages = getCurrentPages();
	if (pages.length >= 2) {
		uni.navigateBack();
	} else {
		uni.switchTab({
			url: '/pages/my/index'
		});
	}
};
</script>

<style scoped lang="scss">
.w-container {
	display: flex;
	flex-direction: column;
	width: 100vw;
	height: 100vh;
	background: #F5F5F5;
	box-sizing: border-box;
	
	.w-content {
		flex: 1;
		box-sizing: border-box;
	}
}
</style>
